day 7 code of hackerrank in java